package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.ReleaseTimesWaterAccountService;

import javax.annotation.Resource;

/**
 * 购买发布次数流水账
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/release/times/water/account")
public class ReleaseTimesWaterAccountController {

	@Autowired
	private ReleaseTimesWaterAccountService releaseTimesWaterAccountService;

	@ResponseBody
	@RequestMapping(value = "/create", method = { RequestMethod.POST })
	public Map<String, Object> create(@RequestParam(required = true) String userId,
			@RequestParam(required = true) String remarks, @RequestParam(required = true) Boolean isSuccess,
			@RequestParam(required = true) String orderNumberLocal,
			@RequestParam(required = true) String orderNumberWeiXin, @RequestParam(required = true) Double price,
			@RequestParam(required = true) Double discount, @RequestParam(required = true) Integer times,
			@RequestParam(required = true) Integer giveTimes, @RequestParam(required = true) Integer number) {
		return releaseTimesWaterAccountService.create(userId, remarks, isSuccess, orderNumberLocal, orderNumberWeiXin,
				price, discount, times, giveTimes, number);
	}

	@ResponseBody
	@RequestMapping(value = "/delete/by/id", method = { RequestMethod.POST })
	public Map<String, Object> deleteById(@RequestParam(required = true) String id) {
		return releaseTimesWaterAccountService.deleteById(id);
	}

	@ResponseBody
	@RequestMapping(value = "/update", method = { RequestMethod.POST })
	public Map<String, Object> update(@RequestParam(required = true) String id,
			@RequestParam(required = false) String userId, @RequestParam(required = false) String remarks,
			@RequestParam(required = false) Boolean isSuccess, @RequestParam(required = false) String orderNumberLocal,
			@RequestParam(required = false) String orderNumberWeiXin, @RequestParam(required = false) Double price,
			@RequestParam(required = false) Double discount, @RequestParam(required = false) Integer times,
			@RequestParam(required = false) Integer giveTimes, @RequestParam(required = false) Integer number) {
		return releaseTimesWaterAccountService.update(id, userId, remarks, isSuccess, orderNumberLocal,
				orderNumberWeiXin, price, discount, times, giveTimes, number);
	}

	@ResponseBody
	@RequestMapping(value = "/select/all", method = { RequestMethod.GET })
	public Map<String, Object> selectAll(@RequestParam(required = false) String yearMonth) {
		return releaseTimesWaterAccountService.selectAll(yearMonth);
	}

	@ResponseBody
	@RequestMapping(value = "/select/one/by/id", method = { RequestMethod.GET })
	public Map<String, Object> selectOneById(@RequestParam(required = true) String id) {
		return releaseTimesWaterAccountService.selectOneById(id);
	}

}
